<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>分局2</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link href="css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="css/plugins/zTreeStyle/zTreeStyle.css" rel="stylesheet">
    <link href="css/checkbox3.min.css" rel="stylesheet">
    <!--<link href="css/plugins/cropper/cropper.min.css" rel="stylesheet">-->
    <!--<link href="css/plugins/datapicker/datepicker3.css" rel="stylesheet">-->
    <!-- jqgrid-->
    <link href="css/plugins/jqgrid/ui.jqgrid.css?0820" rel="stylesheet">
    <link href="css/style.css?v=4.0.0" rel="stylesheet">
    <link href="css/yh.css" rel="stylesheet">
    <link rel="stylesheet" href="css/zTreeStyle/metro.css" />
    <script src="js/controllerJs/rolebtn.js" type="text/javascript" charset="utf-8"></script>
</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">

    <div>

        <div class="col-sm-12">
            <div class="ibox float-e-margins">
            <div class="ibox-title">
                <div class="menu-div">
                    <button class="btn btn-outline btn-primary" data-toggle="modal" data-target="#myModal" id="add-btn">新增 </button>
                    <!--<button class="btn ">新增</button>-->
                    <button class="btn btn-outline btn-primary" data-toggle="modal" id="update-btn">修改</button>
                    <button class="btn btn-outline btn-danger" id="delete-btn">删除</button>
                    <!--<button class="btn btn-outline btn-primary" data-toggle="modal" data-target="#myModal1" id="jssq-btn">角色授权</button>
                    <button class="btn btn-outline btn-danger" data-toggle="modal" data-target="#myModal2" id="jcsq-btn">解除授权</button>-->
                </div>
                <div class="search-div">
                    <input type="text" class="search" id="roletextss" placeholder="按名称搜索..." />
                    <button class="btn btn-primary btn-sm" id="rolebtnss">搜索</button>
                </div>
                <div class="jqGrid_wrapper">
                    <table id="table_list_1"></table>
                    <div id="pager_list_1"></div>
                </div>
                <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                    <div class="modal-dialog">
                        <div class="modal-content">
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                                <h4 class="modal-title" id="myModalLabel">新增信息</h4>
                                <!--<h4 class="" id="">新增信息</h4>-->
                            </div>
                            <!--<div class="modal-body">-->
                            <!--新增用户信息-->
                            <div class="add-hide">
                                <form class="form-horizontal m-t" id="commentForm" action="javascript:rolebtnbc();">
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">库名：</label>
                                        <div class="col-sm-8">
                                            <input id="cname" name="name" minlength="2" type="text" class="form-control" required="" aria-required="true">
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">用途：</label>
                                        <div class="col-sm-8">
                                            <input id="stageCode" name="stageCode" type="text" class="form-control" required="">
                                        </div>
                                        <!--<div class="col-sm-8">
                                            <select class="form-control" name="stageCode" id="stageCode">
                                                <option value="1">市局</option>
                                                <option value="1">分局</option>
                                                <option value="1">派出所/警务站</option>
                                            </select>
                                        </div>-->
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">地址：</label>
                                        <div class="col-sm-8">
                                            <input id="privilegeCode" name="privilegeCode" type="text" class="form-control" required="">
                                        </div>
                                    </div>

                                    <!--<div class="form-group">
                                        <label class="col-sm-3 control-label">备注：</label>
                                        <div class="col-sm-8">
                                            <textarea id="remark" name="remark" type="text" class="form-control" required=""></textarea>
                                        </div>
                                    </div>-->

                                    <div class="form-group">
                                        <div class="modal-footer">
                                            <button type="button" class="btn btn-default" data-dismiss="modal" id="rolebtngb">关闭</button>
                                            <button type="submit" class="btn btn-primary" id="btnbc">保存</button>
                                        </div>
                                    </div>
                                </form>
                                <!--</div>-->

                            </div>

                        </div>
                    </div>
                </div>
            </div>
        </div>

        </div>

        <!-- 全局js -->
        <script type="text/javascript" src="js/jquery.min.js"></script>
        <script src="js/bootstrap.min.js?v=3.3.5"></script>

        <script src="js/plugins/datapicker/bootstrap-datepicker.js"></script>
        <!-- Bootstrap-Treeview plugin javascript -->
        <script src="js/plugins/ztree/jquery.ztree.core.js"></script>
        <script src="js/plugins/ztree/jquery.ztree.excheck.js"></script>

        <!-- jqGrid -->
        <script src="js/plugins/jqgrid/i18n/grid.locale-cn.js?0820"></script>
        <script src="js/plugins/jqgrid/jquery.jqGrid.min.js?0820"></script>

        <script src="js/plugins/validate/jquery.validate.min.js"></script>
        <script src="js/plugins/validate/messages_zh.min.js"></script>

        <script src="js/plugins/layer/layer.min.js"></script>

        <script src="js/plugins/datapicker/bootstrap-datepicker.js"></script>
        <!-- Bootstrap-Treeview plugin javascript -->
        <script src="js/plugins/treeview/bootstrap-treeview.js"></script>
        <script src="js/demo/treeview-demo.js"></script>

        <script src="js/common/config.js" type="text/javascript" charset="utf-8"></script>
        <script src="js/demo/form-validate-demo.js"></script>
        <script src="js/controllerJs/role.js"></script>

        <script src="js/jquery.serializejson.js" type="text/javascript" charset="utf-8"></script>
        <script>

            var setting = {
                check: {
                    enable: true
                },
                data: {
                    simpleData: {
                        enable: true
                    }
                },
                callback: {
                    onCheck: zTreeOnCheck
                },
                view: {
                    selectedMulti: true
                }
            };

            var setting1 = {
                check: {
                    enable: true
                },
                data: {
                    simpleData: {
                        enable: true
                    }
                },
                callback: {
                    onCheck: zTreeOnCheck1
                },
                view: {
                    selectedMulti: true
                }
            };


            var zNodes = [];
            var zNodes1 = [];
            $.ajax({
                type: "get",
                url: YZ.ajaxURLms+"api/jp-BIRM-UserProfile-ms/priFuncs/",
                async: false,
                success: function(data) {
                    for(var i = 0; i < data.length; i++) {
                        var o = new Object();
                        o.id = data[i]["id"];
                        o.name = data[i]["name"];
                        if(data[i]["parentPrivilegeFunction"] == null) {
                            o.pId = "";
                        } else {
                            o.pId = data[i]["parentPrivilegeFunction"]["id"];
                        }
                        zNodes.push(o);
                    }
                }
            });

            $.ajax({
                type: "get",
                url: YZ.ajaxURLms+"api/jp-BIRM-UserProfile-ms/priActions/queryAll/",
                async: false,
                success: function(data) {
                    for(var i = 0; i < data.length; i++) {
                        var o = new Object();
                        o.id = data[i]["id"];
                        o.name = data[i]["name"];
                        if(data[i]["parentPrivilegeFunction"] == null) {
                            o.pId = "";
                        } else {
                            o.pId = data[i]["parentPrivilegeFunction"]["id"];
                        }
                        zNodes1.push(o);
                    }
                }
            });


            $(document).ready(function() {
                $.fn.zTree.init($("#treeDemo"), setting, zNodes);
                $.fn.zTree.init($("#treeDemo1"), setting1, zNodes1);
                //						setCheck();
                //						$("#py").bind("change", setCheck);
                //						$("#sy").bind("change", setCheck);
                //						$("#pn").bind("change", setCheck);
                //						$("#sn").bind("change", setCheck);

                $.jgrid.defaults.styleUI = 'Bootstrap';


            });
        </script>
</body>

</html>